# sms_manager.py
from ronglian_sms_sdk import SmsSDK


class SMSManager:
    # 类属性 - 配置信息
    ACC_ID = '2c94811c93863e4f0193bacb97310ce3'
    ACC_TOKEN = 'e6eb3d3d2a3748a6a34a653c613e0dde'
    APP_ID = '2c94811c93863e4f0193bacb98d80cea'

    def __init__(self):
        self.sdk = SmsSDK(self.ACC_ID, self.ACC_TOKEN, self.APP_ID)
        print("短信服务初始化完成")

    def send_message(self, tid, mobile, datas):
        """发送短信"""
        try:
            resp = self.sdk.sendMessage(tid, mobile, datas)
            print(f"短信发送结果: {resp}")
            return resp
        except Exception as e:
            print(f"短信发送失败: {e}")
            return None



# 创建单例实例
sms_manager = SMSManager()


# 便捷函数
def send_message(tid, mobile, datas):
    return sms_manager.send_message(tid, mobile, datas)


if __name__ == '__main__':
    send_message(1,18006748603,(1234,1))